package com.bw.parkingspace_module.parking.adapter

import android.widget.TextView
import com.bw.parkingspace_module.R
import com.bw.parkingspace_module.parking.entity.ParkingAllEntity
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

//车位申请ui适配器
class ParkingAdapter : BaseMultiItemQuickAdapter<ParkingAllEntity, BaseViewHolder>() {
    init {
        addItemType(1,R.layout.item_parkingq)
        addItemType(2,R.layout.item_parking)
    }


    override fun convert(holder: BaseViewHolder, item: ParkingAllEntity) {
        if (item.itemType == 1) {
            holder.setText(R.id.item_parking_textq, item.name)
        } else if (item.itemType == 2) {
            var textView = holder.getView<TextView>(R.id.item_parking_text)
            textView.setBackgroundColor(item.color)
            textView.setText(item.name)
        }
    }
}